package com.bdqn.t350.ch09.exception;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class AddHandler {

    private static final Logger log = LoggerFactory.getLogger(AddHandler.class);

    @ExceptionHandler(value = {AddException.class})
    public String addHandle(Model model, AddException e) {
        log.info("添加异常");
        model.addAttribute("msg", e.getMessage());
        return "/error/adderror";
    }
}
